package com.newasia.search.dto;

import com.newasia.commons.result.AbstractRequest;
import com.newasia.search.SearchException;
import com.newasia.search.consts.SearchEnum;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

@Data
public class BlogRequest extends AbstractRequest {

    private String id;

    private String title;

    private Date time;

    @Override
    public void requestCheck() {
        if (StringUtils.isAllBlank(title)) {
            throw SearchException.create(SearchEnum.STRING_EMPTY.getCodeString(),
                    SearchEnum.STRING_EMPTY.param(title));
        }
    }
}
